<?php
include '../include/init.php';

$type=trim($_POST['type']);

if($type=="getclassic")
{
	$uh=new userheadModel();

	$uhs=$uh->getclassic();

	if($uhs)
	{
		die(json_encode($uhs));
	}
	else
	{
		die(json_encode('no'));
	}
}
else if($type=="getgif")
{
	$uh=new userheadModel();

	$uhs=$uh->getgif();

	if($uhs)
	{
		die(json_encode($uhs));
	}
	else
	{
		die(json_encode('no'));
	}
}
else if($type=="getall")
{
	$uh=new userheadModel();

	$uhs=$uh->getall();

	if($uhs)
	{
		die(json_encode($uhs));
	}
	else
	{
		die(json_encode('no'));
	}
}
else if($type=="vipcheck")
{
	$uid=$_POST['u']+0;
	$hid=$_POST['h']+0;

	$user=new userModel();
	$uh=new userheadModel();

	$viper=$user->getone($uid,'isvip');
	$imghead=$uh->getrow($hid);

	//if($imghead&&$viper!=false)
	//{
		if($imghead['isvip']==$viper||$imghead['isfree']==1)
		{
			die(json_encode('ok'));
		}
	//}

	die(json_encode('no'));
}